#include "devicechannel.h"
#include "devicesubchannel.h"

DeviceChannel::DeviceChannel(QObject *parent)
    : QObject(parent),
    m_strChannelName(""),
    m_strAmplifierName(""),
    m_dlbMeasureRangeMin(0.0),
    m_dlbMeasureRangeMax(0.0),
    m_strChannelNikeName(""),
    m_strUnit(""),
    m_nChannelMode(0),
    m_nInputConfiguration(0),
    m_dblMaximunValue(0.0),
    m_dblMinimunValue(0.0),
    m_nSampleRate(0),
    m_nToReadSampleCount(0),
    m_nCouple(0),
    m_bEnableIEPE(false),
    m_cColor(Qt::black),
    m_bEnabled(false)
{
    // 其他初始化逻辑...
}

DeviceChannel::~DeviceChannel()
{
    // 释放子通道对象
    qDeleteAll(m_vecChildren);
    m_vecChildren.clear();
}

QString DeviceChannel::channelName() const
{
    return m_strChannelName;
}

void DeviceChannel::setChannelName(const QString &name)
{
    m_strChannelName = name;
}

QString DeviceChannel::amplifierName() const
{
    return m_strAmplifierName;
}

void DeviceChannel::setAmplifierName(const QString &name)
{
    m_strAmplifierName = name;
}

void DeviceChannel::addSubChannel(DeviceSubChannel *subChannel)
{
    if (subChannel) {
        m_vecChildren.append(subChannel);
    }
}

const QVector<DeviceSubChannel*>& DeviceChannel::subChannels() const
{
    return m_vecChildren;
}
